//
//  MKBaseNavigationController.m
//  singForYou
//
//  Created by nicolas on 2017/3/8.
//  Copyright © 2017年 nicolas. All rights reserved.
//

#import "MKBaseNavigationController.h"

@interface MKBaseNavigationController ()

@end

@implementation MKBaseNavigationController

//在程序运行时，iOS系统会把项目中所有的文件加载到内容当中，就会调用load方法
+ (void)load{
    
}

//这个方法时在类第一次创建对象的时候调用-先调用父类的initialize 然后再调用自己的initialize
+ (void)initialize {
    
    if (self == [MKBaseNavigationController class]) {
        //获得整个项目中所有的UINavigationBar对象
        UINavigationBar *navigationBar = [UINavigationBar appearance];
        //设置导航控制器的背景色
        [navigationBar setBackgroundImage:[UIImage imageNamed:@""] forBarMetrics:UIBarMetricsDefault];
        
        //设置字体颜色-修改title的颜色+字体大小
        NSDictionary *dict = @{NSForegroundColorAttributeName:[UIColor blackColor],NSFontAttributeName:[UIFont systemFontOfSize:20]};
        [navigationBar setTitleTextAttributes:dict];
        navigationBar.tintColor = [UIColor blackColor];
    }

}

//重写此方法来实现跳转界面之前来关闭底部标签栏
//当调用控制器内容的navigationController 属性 去push一个界面的时候,会调用此方法来跳转界面
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
    //关闭跳转界面时,底部标签栏
    viewController.hidesBottomBarWhenPushed = YES;
    [super pushViewController:viewController animated:animated];
    viewController.hidesBottomBarWhenPushed = NO;
    
}

- (UIViewController *)popViewControllerAnimated:(BOOL)animated{
    return [super popViewControllerAnimated:animated];
}


@end
